import Vue from 'vue'
import Vuex from 'vuex'
import { getItem, setItem } from '@/utils/storage'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    tokenInfo: getItem('tokenInfo') || {}
  },
  mutations: {
    mSetTokenInfo (state, tokenObj) {
      // 1.修改token
      state.tokenInfo = tokenObj
      // 2.持久化
      setItem('tokenInfo', tokenObj)
    }
  }
})
